﻿Imports System.Data
Imports System.IO
Partial Class WebForm_UI_UIDefine
    Inherits BasePage
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim dirInfo As DirectoryInfo = New DirectoryInfo(Server.MapPath("~/CSS"))
            For Each dirName As DirectoryInfo In dirInfo.GetDirectories()
                If dirName.Name <> ".svn" Then
                    ddlTheme.Items.Add(dirName.Name)
                End If
            Next
            GetData()

        End If


    End Sub

    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim uBBl As OAMS.BBL.UsersBBL = New OAMS.BBL.UsersBBL()
        uBBl.UpdateUIDefine(ActualUID, ddlUICulture.SelectedValue, ddlTheme.SelectedValue, cbMenuCollapsible.Checked, cbWinTargetBlank.Checked, dbName)
        Dim bbl1 As OAMS.BBL.UsersBBL = New OAMS.BBL.UsersBBL()

        Session("GlobalLanguage") = bbl1.GetLanguage(Session("ActualUID").ToString(), Session("dbName").ToString)
        Session("Theme") = bbl1.GetTheme(Session("ActualUID").ToString(), Session("dbName").ToString)
        Session("MenuCollapsible") = bbl1.GetMenuCollapsible(Session("ActualUID").ToString(), Session("dbName").ToString)
        Session("WinTargetBlank") = bbl1.GetWinTargetBlank(Session("ActualUID").ToString(), Session("dbName").ToString)
        RunClientScriptForAjax(Me, "window.parent.parent.top.location='" + ResolveUrl("~/WebForm/Main/MainPage.aspx") + "'")
        ' Page.ClientScript.RegisterClientScriptBlock(GetType(BasePage), "StartPage2", "<script language=JavaScript>  window.parent.parent.top.location='" + ResolveUrl("~/WebForm/Main/MainPage.aspx") + "';</script>")
    End Sub
    Private Sub GetData()
        Dim uBBl As OAMS.BBL.UsersBBL = New OAMS.BBL.UsersBBL()
        ddlUICulture.SelectedValue = GetUserLanguage()
        ddlTheme.SelectedValue = GetTheme()
        cbMenuCollapsible.Checked = GetMenuCollapsible()
        cbWinTargetBlank.Checked = GetWinTargetBlank()
    End Sub


End Class
